package com.demo.project_template.vo.response;

import com.alibaba.fastjson2.annotation.JSONField;
import com.demo.project_template.entity.User;
import com.demo.project_template.util.JwtUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;

import java.util.List;


/**
 * @author yyl25
 */
@Data
@NoArgsConstructor
public class LoginResponseVo {
    private Long userId;

    private String token;

    @ApiModelProperty("0=后台用户，1=前台用户")
    private Integer type;

    @ApiModelProperty(value = "性别")
    private String gender;

    public LoginResponseVo(User user, Integer type){
        this.userId = user.getId();
        this.gender = user.getGender();
        this.type = type;
        this.token = JwtUtil.createJWT(this.userId.toString());
    }
}
